package com.dragon.refect.annotation;

import java.util.Arrays;

/**
 * @author dragon
 * @since 2019/12/2
 */
public class InheritedDemo {

    @DocumentA
    static class A {

    }

    static class B extends A {

    }

    @DocumentB
    static class C {

    }

    static class D extends C {

    }

    public static void main(String[] args) {
        A instanceA = new B();
        C instanceC = new D();
        // 已使用@Inherited注释: [@com.dragon.refect.annotation.DocumentA()]
        System.out.println("已使用@Inherited注释: " + Arrays.toString(instanceA.getClass().getAnnotations()));
        // 未使用@Inherited注释: []
        System.out.println("未使用@Inherited注释: " + Arrays.toString(instanceC.getClass().getAnnotations()));
    }
}
